/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.its.dsw2.Bl;


import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import mx.its.dsw2.Enumerations.TransactionStatus;
import mx.itsc.ds2.Dao.AssignscholarshipDaoLocal;
import mx.itsc.ds2.model.Assignscholarship;


/**
 *
 * @author Martinez
 */
@Stateless
public class AssignScholarshipBL implements AssignScholarshipBLLocal {
    @EJB
    private AssignscholarshipDaoLocal assignscholarshipDao;

    @Override
    public TransactionStatus register(Assignscholarship assignScholarship) {
            assignscholarshipDao.create(assignScholarship);
            return TransactionStatus.COMPLETO;
    }
    
    

    @Override
    public List<Assignscholarship> findAssignedScholarship(Assignscholarship assignedScholarship) {
        List<Assignscholarship> assignedScholarshipList = assignscholarshipDao.findByAssignedScholarsipId(assignedScholarship);
        List<Assignscholarship> finalAssignedScholarshipList = new ArrayList<Assignscholarship>();
        for (Assignscholarship assignscholarship : assignedScholarshipList) {
            finalAssignedScholarshipList.add(assignscholarship);
        }
        return finalAssignedScholarshipList;
    }

    @Override
    public TransactionStatus modify(Assignscholarship assignedScholarship) {
        assignscholarshipDao.edit(assignedScholarship);
        return TransactionStatus.COMPLETO;
    }

    @Override
    public TransactionStatus delete(Assignscholarship assignScholarship) {
        assignscholarshipDao.remove(assignScholarship);
        return TransactionStatus.COMPLETO;
    }
    
    
}
